﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class artilce_default : Base
{
    public int type = 1;
    BLL.V_ImageUser b = new BLL.V_ImageUser();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.RawUrl.IndexOf("new") > -1)
            type = 1;
        else if (Request.RawUrl.IndexOf("love") > -1)
            type = 2;
        else type = 1;

        base.PageSize = 10;
        BindArticle();
        BindRandom();
        BindUser();
    }

    public void BindArticle()
    {
        string sql = " IsPass =1  ";
        string sort = " AddTime desc";
        if (type == 2) sort = " LoveNum desc";

        BLL.V_Feelings bll = new BLL.V_Feelings();
        Model.PageData<Model.V_Feelings> data = bll.GetList(base.PageSize, base.PageIndex, sql, sort);
        Repeater1.DataSource = data.DataSoure;
        Repeater1.DataBind();
        pgServer.RecordCount = data.Count;
        //pgServer.EnableUrlRewriting = true;
        //string url = string.Format("list-{0}-{1}-{2}.html", base.TypeID, base.ColorID, base.Language);
        //pgServer.UrlRewritePattern = url + "?page={0}";
        pgServer.DataBind();

    }
    public void BindUser()
    {
        BLL.V_UserCount bll = new BLL.V_UserCount();
        List<Model.V_UserCount> lists = bll.GetList(20, " 1=1 ", " FellingCount desc");
        rptPaihang.DataSource = lists;
        rptPaihang.DataBind();
    }
    public void BindRandom()
    {
        List<Model.V_ImageUser> imgs = b.GetList(6, "1=1", " newid() asc");
        rptRandomPic.DataSource = imgs;
        rptRandomPic.DataBind();
    }

}